summaryrefslogtreecommitdiffstats
path: root/Tools
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2013-07-31 14:32:05 +0200
committermadmaxoft <github@xoft.cz>2013-07-31 14:32:05 +0200
commit0b166ee78466617a6405f7a1ead92135cab4a454 (patch)
treeb01c74649b2f6f69a917e4c1f40bb9d657e5246b /Tools
parentImplemented the actual tab completion for commands and playernames. (diff)
downloadcuberite-0b166ee78466617a6405f7a1ead92135cab4a454.tar
cuberite-0b166ee78466617a6405f7a1ead92135cab4a454.tar.gz
cuberite-0b166ee78466617a6405f7a1ead92135cab4a454.tar.bz2
cuberite-0b166ee78466617a6405f7a1ead92135cab4a454.tar.lz
cuberite-0b166ee78466617a6405f7a1ead92135cab4a454.tar.xz
cuberite-0b166ee78466617a6405f7a1ead92135cab4a454.tar.zst
cuberite-0b166ee78466617a6405f7a1ead92135cab4a454.zip
Diffstat (limited to 'Tools')
-rw-r--r--Tools/ProtoProxy/Connection.cpp40
-rw-r--r--Tools/ProtoProxy/Connection.h2
2 files changed, 42 insertions, 0 deletions
diff --git a/Tools/ProtoProxy/Connection.cpp b/Tools/ProtoProxy/Connection.cpp
index 7c808f2c1..79777c52e 100644
--- a/Tools/ProtoProxy/Connection.cpp
+++ b/Tools/ProtoProxy/Connection.cpp
@@ -193,6 +193,7 @@ enum
PACKET_PLAYER_LIST_ITEM = 0xc9,
PACKET_PLAYER_ABILITIES = 0xca,
PACKET_INCREMENT_STATISTIC = 0xc8,
+ PACKET_TAB_COMPLETION = 0xcb,
PACKET_LOCALE_AND_VIEW = 0xcc,
PACKET_CLIENT_STATUSES = 0xcd,
PACKET_PLUGIN_MESSAGE = 0xfa,
@@ -579,6 +580,7 @@ bool cConnection::DecodeClientsPackets(const char * a_Data, int a_Size)
case PACKET_PLAYER_POSITION_LOOK: HANDLE_CLIENT_READ(HandleClientPlayerPositionLook); break;
case PACKET_PLUGIN_MESSAGE: HANDLE_CLIENT_READ(HandleClientPluginMessage); break;
case PACKET_SLOT_SELECT: HANDLE_CLIENT_READ(HandleClientSlotSelect); break;
+ case PACKET_TAB_COMPLETION: HANDLE_CLIENT_READ(HandleClientTabCompletion); break;
case PACKET_UPDATE_SIGN: HANDLE_CLIENT_READ(HandleClientUpdateSign); break;
case PACKET_USE_ENTITY: HANDLE_CLIENT_READ(HandleClientUseEntity); break;
case PACKET_WINDOW_CLICK: HANDLE_CLIENT_READ(HandleClientWindowClick); break;
@@ -687,6 +689,7 @@ bool cConnection::DecodeServersPackets(const char * a_Data, int a_Size)
case PACKET_SPAWN_OBJECT_VEHICLE: HANDLE_SERVER_READ(HandleServerSpawnObjectVehicle); break;
case PACKET_SPAWN_PAINTING: HANDLE_SERVER_READ(HandleServerSpawnPainting); break;
case PACKET_SPAWN_PICKUP: HANDLE_SERVER_READ(HandleServerSpawnPickup); break;
+ case PACKET_TAB_COMPLETION: HANDLE_SERVER_READ(HandleServerTabCompletion); break;
case PACKET_TIME_UPDATE: HANDLE_SERVER_READ(HandleServerTimeUpdate); break;
case PACKET_UPDATE_HEALTH: HANDLE_SERVER_READ(HandleServerUpdateHealth); break;
case PACKET_UPDATE_SIGN: HANDLE_SERVER_READ(HandleServerUpdateSign); break;
@@ -1072,6 +1075,19 @@ bool cConnection::HandleClientSlotSelect(void)
+bool cConnection::HandleClientTabCompletion(void)
+{
+ HANDLE_CLIENT_PACKET_READ(ReadBEUTF16String16, AString, Query);
+ Log("Received a PACKET_TAB_COMPLETION query from the client");
+ Log(" Query = \"%s\"", Query.c_str());
+ COPY_TO_SERVER();
+ return true;
+}
+
+
+
+
+
bool cConnection::HandleClientUpdateSign(void)
{
HANDLE_CLIENT_PACKET_READ(ReadBEInt, int, BlockX);
@@ -2103,6 +2119,30 @@ bool cConnection::HandleServerSpawnPickup(void)
+bool cConnection::HandleServerTabCompletion(void)
+{
+ HANDLE_SERVER_PACKET_READ(ReadBEUTF16String16, AString, Results);
+ Log("Received a PACKET_TAB_COMPLETION from the server, results given:");
+
+ // Parse the zero-terminated list of results:
+ size_t len = Results.size();
+ size_t last = 0;
+ for (size_t i = 0; i < len; i++)
+ {
+ if (Results[i] == 0)
+ {
+ Log(" \"%s\"", Results.substr(last, i - last).c_str());
+ last = i + 1;
+ }
+ }
+ COPY_TO_CLIENT();
+ return true;
+}
+
+
+
+
+
bool cConnection::HandleServerTimeUpdate(void)
{
HANDLE_SERVER_PACKET_READ(ReadBEInt64, Int64, WorldAge);
diff --git a/Tools/ProtoProxy/Connection.h b/Tools/ProtoProxy/Connection.h
index 942ee6e06..8d466c62d 100644
--- a/Tools/ProtoProxy/Connection.h
+++ b/Tools/ProtoProxy/Connection.h
@@ -128,6 +128,7 @@ protected:
bool HandleClientPlayerPositionLook(void);
bool HandleClientPluginMessage(void);
bool HandleClientSlotSelect(void);
+ bool HandleClientTabCompletion(void);
bool HandleClientUpdateSign(void);
bool HandleClientUseEntity(void);
bool HandleClientWindowClick(void);
@@ -177,6 +178,7 @@ protected:
bool HandleServerSpawnObjectVehicle(void);
bool HandleServerSpawnPainting(void);
bool HandleServerSpawnPickup(void);
+ bool HandleServerTabCompletion(void);
bool HandleServerTimeUpdate(void);
bool HandleServerUpdateHealth(void);
bool HandleServerUpdateSign(void);